package cn.eeepay.framework.dao;

import cn.eeepay.framework.model.AccountAddressLog;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultType;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.jdbc.SQL;

import java.math.BigDecimal;
import java.util.Map;

/**
 * 账单地
 *
 * @author hzl
 * @date 2020/11/12
 */
public interface AccountAddressLogDao {

//    @Select("select sum(count_quota) total_amount from account_address_log where address = #{accountAddress} and account_date >= #{date} ")
//    BigDecimal collectAccountAddrTotalAmount(@Param("accountAddress") String accountAddress, @Param("date") String date);

    @Select("select * from account_address_log where address = #{accountAddress} and account_date = #{date} ")
    @ResultType(AccountAddressLog.class)
    AccountAddressLog findAccountAddress(@Param("accountAddress") String accountAddress, @Param("date") String date);


    @Insert("INSERT INTO account_address_log (address,count_quota,used_quota,account_date,create_time,reserved_amount,release_time,address_type) values (#{address},#{countQuota}" +
            ",#{usedQuota},#{accountDate},#{createTime},#{reservedAmount},#{releaseTime},#{addressType})")
    int insert(AccountAddressLog accountAddressLog);

}
